#pragma once

#include "fxcc/core/graph/common/Scene.h"
#include "fxcc/core/graph/common/Effect3d.h"
#include "fxcc/core/graph/common/ChannelDataSet.h"

namespace fxcc
{
	namespace graph
	{
		namespace common
		{

			struct FXCC_API    BoneNode
			{
				std::string m_NodeName;

				fxcc::graph::common::Transform m_NodeOffset, m_NodeTransform, m_BoneOffset, m_BoneFinal;
				
				std::map<std::string, Bone> m_Bones;

				const fxcc::graph::common::Node *m_RootNode;

				int m_BoneIndex = -1;

				BoneNode(const fxcc::graph::common::Scene* scene);

				BoneNode(const fxcc::graph::common::Node *node, const std::map<std::string, Bone> &bones);

				bool CreateFrom(const fxcc::graph::common::Node *node);

				void LoadLocalTransform(const fxcc::graph::common::ChannelDataSet* channelDataSet);

				void ProcessNode(fxcc::graph::common::Transform parentModel);

				void UpdateBuffer(fxcc::graph::common::Effect3d::BoneData& target);

				std::vector<std::shared_ptr<BoneNode>> children;
			};

		};
	};
}
